package cn.com.xy.sms.sdk.ui.popu.part;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import cn.com.xy.sms.sdk.Iservice.XyCallBack;
import cn.com.xy.sms.sdk.smsmessage.BusinessSmsMessage;
import cn.com.xy.sms.sdk.ui.R;
import cn.com.xy.sms.sdk.ui.popu.util.ChannelContentUtil;
import cn.com.xy.sms.sdk.ui.popu.util.ThemeUtil;

public class BubbleCodeHeadCMCC extends UIPart {

    private ImageView mRightlogo;
    private TextView mTitleText;

    public BubbleCodeHeadCMCC(Activity context, BusinessSmsMessage message, XyCallBack callback, int layoutId,
                              ViewGroup root, int partId) {
        super(context, message, callback, layoutId, root, partId);
        // TODO Auto-generated constructor stub
    }

    @Override
    public void initUi() throws Exception {
        // TODO Auto-generated method stub
        super.initUi();
        mRightlogo = (ImageView) mView.findViewById(R.id.duoqu_right_logo);
        mTitleText = (TextView) mView.findViewById(R.id.duoqu_title_text);
    }

    @SuppressLint("ResourceAsColor")
    @Override
    public void setContent(BusinessSmsMessage message, boolean isRebind) throws Exception {
        // TODO Auto-generated method stub
        super.setContent(message, isRebind);

        this.mMessage = message;
        ThemeUtil.setTextColor(mContext, mTitleText, (String) message.getValue("v_hd_color"),
                R.color.duoqu_theme_color_4010);

        ThemeUtil.setViewBg(mContext, mRightlogo, (String) message.getValue("v_hd_icon_11"),
                R.drawable.duoqu_v_hd_icon_11);

        ChannelContentUtil.setText(mTitleText, (String) message.getValue("view_title_name"), "");
    }

    public void setLogoOnClickListener(View.OnClickListener click){
        mRightlogo.setOnClickListener(click);
    }

}
